Skip to main content

BOJ 1475

1475 방 번호

tip

Clicking the heading will take you to the BOJ problem.

Solution

6과 9를 어떻게 동일하게 처리할 것인지가 포인트. 단순 수학이지만 바로 생각이 나지 않았다.

num = input()
count = [0] * 10

for c in num:
    count[int(c)] += 1

count[6] = (count[6] + count[9] + 1) // 2
count[9] = 0  

print(max(count))